package main.java.jdbc11;

import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

/**
 * @Auther:Liu
 * @Testname:Test
 * @Date:2025/3/11 17:01
 */
public class Test {
    public static void main(String[] args) throws Exception {
        Properties pro = new Properties();
        //i/o流
        pro.load(new FileInputStream("src\\jdbc.properties"));
        String user = pro.getProperty("user");
        String password = pro.getProperty("password");
        String url = pro.getProperty("url");
        String driver = pro.getProperty("driver");
        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, user, password);
        Statement statement = connection.createStatement();
        String s = "select * from stu_student";
        ResultSet resultSet = statement.executeQuery(s);
        boolean next = resultSet.next();
        System.out.println(next);
        int id = resultSet.getInt("stu_id");
        System.out.println(id);

    }

}
